package com.goodo.card.api.controller;

import com.goodo.card.api.common.Result;
import com.goodo.card.api.repository.CardsRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author xuyanbo
 * @date 2018/3/11
 */
@RequestMapping("/api/card")
@Controller
public class CardController {

    @Autowired
    private CardsRepository cardsRepository;

    @GetMapping("/info")
    @ResponseBody
    public Object info(@RequestParam(name="seqid", required=false) String seqid,
                       @RequestParam("id") String id) {
        Result res = new Result(seqid);
        res.setData(cardsRepository.findByCardId(id));
        return res;
    }

}
